import { View } from "@tarojs/components"
import Taro from "@tarojs/taro"
import { values } from "lodash"
import { useRef, useState } from "react"
import { AtButton, AtForm, AtTextarea } from "taro-ui"




const enrollComments = () => {
    const [morning, setMorning] = useState("")
    const [aft, setAft] = useState("")
    const [night, setNight] = useState("")

    // const [list, setList] = useState([])
    const list = useRef({})

    const Updta=()=>{
        let newList=[{
            morning:morning,
            aft:aft,
            night:night
        }
        ]
        //写入数组
        list.current=newList
    }


    //调用云函数
    const handleUpdata=()=>{
        Taro.cloud.callFunction({
            name:"publication",
            data:{
                $url:"",
                
            }
        }).then(()=>{
            Taro.showModal({
                title: '温馨提示',
                content: '您已成功提交',
                showCancel: false
            });
            return;
        })
    }
    return (
        <View>
            <AtForm
                onSubmit={Updta}
                // onReset={}
            >
                <AtTextarea
                    value={morning}
                    onChange={value=>{setMorning(value)}}
                    maxLength={200}
                    placeholder='妈妈上午的规划...'
                />
                <AtTextarea
                    value={aft}
                    onChange={value=>{setAft(value)}}
                    maxLength={200}
                    placeholder='妈妈下午午的规划...'
                />
                <AtTextarea
                    value={night}
                    onChange={value=>{setNight(value)}}
                    maxLength={200}
                    placeholder='妈妈晚上的规划...'
                />
                <AtButton formType='submit' onClick={}>提交</AtButton>
                <AtButton formType='reset'>重置</AtButton>
            </AtForm>
        </View>
    )
}
export default enrollComments


